package com.mangaenglish.common.result;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jdk.nashorn.internal.ir.annotations.Ignore;
import lombok.Builder;
import lombok.Data;

import java.util.Objects;

/**
 * Created by Administrator on 2018/1/7 0007.
 */
@Data
@Builder
public class Result<T> {

    public static final Integer RESULT_SUCCESS = 200;

    private Integer sate;
    private String msg;
    T result;

    public Boolean isSuceess(){
        return Objects.equals(sate, RESULT_SUCCESS);
    }

    public static<T> Result<T> createSucess(T results){
        return Result.<T>builder().sate(RESULT_SUCCESS).result(results).build();
    }

    public static<T> Result<T> createFail(Integer sate, T results){
        return Result.<T>builder().sate(sate).result(results).build();
    }

}
